﻿using System;
using System.Collections.Generic;
using System.Web;
using AMS.DataAccess.BO;
using AMS.DataAccess.BO.Enums;
using AMS.DataAccess.Trademark.BO.Enums;

/// <summary>
/// Summary description for EnumConverter
/// </summary>
public static class EnumConverter
{
    private static volatile object syncObj = new object();
    private static Dictionary<CustomerType, string> CustomerTypeMapping;
    private static Dictionary<CustomerBusinessType, string> CustomerBusinessTypeMapping;
    private static Dictionary<TaskPriority, string> TaskPriorityTypeMapping;

    public static string CustomerTypeToString(CustomerType cusType)
    {
        if (CustomerTypeMapping == null)
        {
            lock (syncObj)
            {
                if (CustomerTypeMapping == null)
                {
                    CustomerTypeMapping = new Dictionary<CustomerType, string>();
                    CustomerTypeMapping.Add(CustomerType.Unknown, "未知");
                    CustomerTypeMapping.Add(CustomerType.Personal, "个人客户");
                    CustomerTypeMapping.Add(CustomerType.Company, "公司客户");
                    CustomerTypeMapping.Add(CustomerType.Angency, "代理机构");
                }
            }
        }

        return CustomerTypeMapping[cusType];
    }

    public static string CustomerBusinessTypeToString(CustomerBusinessType bizType)
    {
        if (CustomerBusinessTypeMapping == null)
        {
            lock (syncObj)
            {
                if (CustomerBusinessTypeMapping == null)
                {
                    CustomerBusinessTypeMapping = new Dictionary<CustomerBusinessType, string>();
                    CustomerBusinessTypeMapping.Add(CustomerBusinessType.Unspesified, "未说明");
                    CustomerBusinessTypeMapping.Add(CustomerBusinessType.Applicant, "申请人");
                    CustomerBusinessTypeMapping.Add(CustomerBusinessType.Client, "委托人");
                    CustomerBusinessTypeMapping.Add(CustomerBusinessType.ClientAndApplicant, "委托人兼申请人");
                }
            }
        }

        return CustomerBusinessTypeMapping[bizType];
    }

    public static string TaskPriorityTypeToString(TaskPriority priority)
    {
        if (TaskPriorityTypeMapping == null)
        {
            lock (syncObj)
            {
                if (TaskPriorityTypeMapping == null)
                {
                    TaskPriorityTypeMapping = new Dictionary<TaskPriority, string>();
                    TaskPriorityTypeMapping.Add(TaskPriority.Normal, "普通");
                    TaskPriorityTypeMapping.Add(TaskPriority.High, "高");
                    TaskPriorityTypeMapping.Add(TaskPriority.Low, "低");
                }
            }
        }

        return TaskPriorityTypeMapping[priority];
    }
}
